package main

import (
	"bytes"
	"io"
	"log"
	"net/http"
)

func GetOnline(url string) ([]byte, error) {
	resp, err := http.Get(url)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	if body, err := io.ReadAll(resp.Body); err != nil {
		log.Println("文件下载失败")
		return nil, err
	} else {
		return io.ReadAll(bytes.NewReader(body))
	}
}
